From 59e0af401add55caa6351f21cc0637422556a02f Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 12 May 2010 08:52:30 +0100 Subject: [PATCH] xl: Add "xl top" command, a clone of "xm top". Signed-off-by: Yang Hongyang --- tools/libxl/xl_cmdimpl.c | 20 ++++++++++++++++++++ tools/libxl/xl_cmdimpl.h | 1 + tools/libxl/xl_cmdtable.c | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 1e2304756e..ddb0bfd132 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3098,3 +3098,23 @@ int main_sysrq(int argc, char **argv) exit(0); } + +int main_top(int argc, char **argv) +{ + int opt; + + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case 'h': + help("top"); + exit(0); + default: + fprintf(stderr, "option `%c' not supported.\n", opt); + break; + } + } + + system("xentop"); + + exit(0); +} diff --git a/tools/libxl/xl_cmdimpl.h b/tools/libxl/xl_cmdimpl.h index c08c5d1593..3c7b9fd1f6 100644 --- a/tools/libxl/xl_cmdimpl.h +++ b/tools/libxl/xl_cmdimpl.h @@ -40,5 +40,6 @@ int main_domname(int argc, char **argv); int main_rename(int argc, char **argv); int main_trigger(int argc, char **argv); int main_sysrq(int argc, char **argv); +int main_top(int argc, char **argv); void help(char *command); diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index 33582a79d9..3609e1b93f 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -177,6 +177,11 @@ struct cmd_spec cmd_table[] = { "Send a sysrq to a domain", " ", }, + { "top", + &main_top, + "Monitor a host and the domains in real time", + "", + }, }; int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec); -- 2.30.2